Skip to content

Unify colour handling in selects and buttons - #140

Open
biast12 wants to merge 1 commit into
masterfrom
colour-dot-selects
Open

Unify colour handling in selects and buttons#140
biast12 wants to merge 1 commit into
masterfrom
colour-dot-selects

Conversation

@biast12

@biast12 biast12 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Description

The Button Colour picker on the panel create/edit pages listed Blue / Grey / Green / Red as plain text — you had to already know Discord's palette to pick correctly. Each option now shows its actual colour, plus the same treatment everywhere else it fits.

Select already supported a per-option color; the options simply never passed one, so no new component was needed.

Changes

Button Colour — options carry their colour, shared from a new constants/buttonStyles.ts so the picker and the live PanelPreview read from one table.

⚠️ Visible change: the preview palette moves from Discord's old hover shades (#4752c4 / #4f545c / #2d7d46 / #a12d2f) to its current button colours (#5865F2 / #4E5058 / #248046 / #DA373C), so preview buttons now match what Discord actually renders. discord/container/Button.tsx paints the background inline rather than via a Tailwind class — a class name built from a map is never generated at build time.

Dots that never workedMultiSelect expected abc123 for its dot but #abc123 for its chip tint, so one was always invalid CSS. Both selects now normalise the value:

  • a role coloured 0x00b0f4 produced #b0f4 (invalid, no dot) → now #00b0f4
  • an uncoloured role produced #0 → now Discord's default grey #99AAB5 instead of black
  • the selected-chip tint renders for the first time, as color-mix(… 20%) matching LabelBadge

New swatches — the access-control "Add Role" picker (dropdown and the added-role list), the setup wizard's Teams step (colour was being stripped in Setup.tsx), and the Guild Settings / Tickets / Transcripts panel pickers.

Status dots on the four filters whose values already have a badge colour: affiliate status, gallery type (×2), bot-staff tier. GALLERY_TYPE_BADGES is now the single source — the duplicate map in GalleryCard.tsx and both local TYPE_OPTIONS copies are gone.

intToColour / colourToInt were defined three times; both now live in lib/colour.ts.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Improvement

Checklist

  • My code follows the style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Adds shared colour utilities (`lib/colour.ts`) and centralized Discord button style constants (`constants/buttonStyles.ts`), then refactors components/pages to use them. This removes duplicated hex conversion logic, normalizes colour input formats, and applies consistent color swatches in Select/MultiSelect/role-related UIs (including proper fallback for Discord role color `0`). It also reuses shared gallery type badge/options metadata to eliminate duplicated type option definitions.
@biast12
biast12 requested a review from a team as a code owner September 5, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant